package com.yl.service.impl;

import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.yl.common.core.domain.AjaxResult;
import com.yl.config.ShengWangUrlConfig;
import com.yl.domain.ConferenceApplyDO;
import com.yl.domain.StudentReplyDO;
import com.yl.domain.dto.StudentDTO;
import com.yl.mapper.StudentReplyMapper;
import com.yl.service.ShengWangService;
import com.yl.service.StudentReplyService;
import com.yl.service.ZhiXingService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

@Service
public class StudentReplyServiceImpl implements StudentReplyService {


    @Resource
    StudentReplyMapper studentReplyMapper;
    @Resource
    ShengWangService shengWangService;
    @Resource
    ShengWangUrlConfig shengWangUrlConfig;
    @Resource
    ZhiXingService zhiXingService;

    /**
     * 保存
     * @param studentReplyDO
     * @author : y
     * @date :  2024/7/10 15:24
     */
    @Override
    public AjaxResult save(StudentReplyDO studentReplyDO) {
        studentReplyDO.setCreateTime(new Date());
        // 文件地址 m3u8文件
        String stop = shengWangService.stop(studentReplyDO.getCname(), studentReplyDO.getUid(), studentReplyDO.getResourceid(), studentReplyDO.getSid());
        System.out.println("结束录制返回的文件地址===="+stop);
        if(StringUtils.isNotBlank(stop)){
             String fileName = shengWangUrlConfig.getOssUrl() + stop;
             studentReplyDO.setReplyM3u8VideoUrl(fileName);
         }
        studentReplyMapper.insert(studentReplyDO);
        return AjaxResult.success("操作成功");
    }

    /**
     * @param studentReplyDO
     * @author : y
     * @date :  2024/7/10 15:26
     */
    @Override
    public AjaxResult findList(StudentReplyDO studentReplyDO) {
        return null;
    }
}
